FROM aiautotest:v1.0.0-beta.20

# RUN npx playwright@1.54.0 install --with-deps
RUN npx playwright install --with-deps
ENV PLAYWRIGHT_BROWSERS_PATH=/root/.cache/ms-playwright

# Install Chromium and dependencies
RUN apt-get update && \
    apt-get install -y \
    libgtk-3-0 \
    libgbm-dev \
    libnss3 \
    libnspr4 \
    libatk1.0-0 \
    libatk-bridge2.0-0 \
    libcups2 \
    libdrm2 \
    libxkbcommon0 \
    libxcomposite1 \
    libxdamage1 \
    libxfixes3 \
    libxrandr2 \
    libgbm1 \
    libasound2 \

RUN rm -rf /app/*
COPY testng-ui-automation /app/testng-ui-automation
COPY pom.xml /app/

RUN mvn -DskipTests clean package install dependency:copy-dependencies -DoutputDirectory=target/lib
